﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using UAXInversionesWeb.logicaNegocio;
using System.Drawing;

namespace UAXInversionesWeb.supervisor
{
    public partial class InformeSaldoNegativo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["identificador"] != null)
            {
                Cliente[] cl = Proxy.obtenerClientesSaldoNegativo();
                if (cl.Length > 0)
                {
                    mensaje.Text = "";
                    TableRow row;
                    TableCell cell, cell2, cell3;

                    for (int i = 0; i < cl.Length; i++)
                    {
                        row = new TableRow();
                        if (i % 2 != 0)
                        {
                            row.BackColor = System.Drawing.Color.FromArgb(240, 244, 247);
                        }

                        cell = new TableCell();
                        cell.HorizontalAlign = HorizontalAlign.Left;
                        cell.Text = cl[i].getNombre();
                        row.Cells.Add(cell);

                        cell2 = new TableCell();
                        cell2.Text = cl[i].getApellidos();
                        row.Cells.Add(cell2);

                        cell3 = new TableCell();
                        cell3.HorizontalAlign = HorizontalAlign.Right;
                        cell3.ForeColor = Color.DarkRed;
                        cell3.Text = cl[i].getSaldo().ToString("N") + " €";
                        row.Cells.Add(cell3);

                        Table1.Rows.Add(row);
                    }
                }
                else
                {
                    mensaje.Text = "No hay clientes con saldo negativo";
                }
            }
        }
    }
}
